<template>
  <view> </view>
</template>

<script>
import { getAppIdByChannelApi } from "@/http/api";
export default {
  data() {
    return {};
  },
  mounted() {
    console.log("onready");
    uni.showLoading({
      title: "加载中",
    });
    let appId = "wxd7155a2ff952621f"; // 默认AppId
    // let baseUrl = 'https://concern.yipuwenhua.com/';
    let baseUrl = window.location.origin + window.location.pathname;
    let type = uni.getStorageSync("channel") || 0;
    if (type === 0) {
      uni.setStorageSync("channel", "0");
    }
    getAppIdByChannelApi({
      type: type,
    }).then((res) => {
      if (res.code === 200) {
        appId = res.msg;
      }
      let redirectUri = encodeURIComponent(
        `${baseUrl}#/pages/getCode/getCode?wxGetcode=1&channel=${type}`
      );
      // window.location.replace(`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${redirectUri}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`)
    });
  },
};
</script>
<style></style>
